package com.hamster.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hamster.crm.pojo.UserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * @author Tarry
 * @create 2020/1/2 10:15
 */
@Repository
@Mapper
public interface UserRoleMapper extends BaseMapper<UserRole> {

    /**
     * 删除该角色相关权限
     * @param roleId
     */
    @Delete("delete from tb_role_permission where role_id = #{id}")
    void deleteRoleAndPermission(@Param("id") String roleId);

    /**
     * 删除该角色相关用户账号
     */
    @Delete("delete from tb_user_role where role_id = #{id}")
    void deleteRoleAndUser(@Param("id") String roleId);
}
